package top.weiliang.springboot3.entity.auth;

import com.baomidou.mybatisplus.annotation.*;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.NonNull;
import top.weiliang.springboot3.volidate.CommonValidate;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
//实体类对应的表名称
@TableName("tb_user_info")
public class TbUserInfo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    //    输入主键
    @TableId(type = IdType.INPUT)
    @NotNull(message = "编号必须填写", groups = {CommonValidate.class})
    @Min(value = 1,message = "编号必须大于0",groups = {CommonValidate.class})
    private Integer id;

    private String sex;
    private String info;
    //正规校验
    @Pattern(message = "手机号格式不正确", regexp = "^1[3-9][0-9]{9}$", groups = {CommonValidate.class})
    private String phone;
    @Pattern(message = "邮箱格式不正确", regexp = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", groups = {CommonValidate.class})
    private String email;
    private String imgurl;
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private Date lastupdate;

}
